package com.cdfive.demo.serviceB.controller;

import com.cdfive.demo.serviceA.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiejihan
 * @date 2019-01-03
 */
@RequestMapping("/")
@RestController
public class HelloController {

    @Autowired
    private HelloService helloService;

    @RequestMapping("/hello")
    public String hello(String name) {
        String result;
        try {
            result = helloService.hello(name);
        } catch (Exception e) {
//            result = "ERROR";
            result = e.getMessage();
            e.printStackTrace();
        }
        return result;
    }
}
